<?php $this->pageTitle=Yii::app()->name; ?>

<h1>Welcome to <i><?php echo CHtml::encode(Yii::app()->name); ?></i></h1>

<?php 




/* //测试用字
$letter= '王松涛';
echo '测试用字：'.$letter ."<br/>";
// $_letter0 = trim($letter,' ');
// echo 'trimed：'.$_letter0 ."<br/>";

//去除空格，并截取前3个汉字（如果存在的话）；
$_letter0= str_replace(' ', '',$letter);
$_letter1= substr($_letter0, 0,3);
$_letter2= substr($_letter0, 3,3);
$_letter3= substr($_letter0, 6,3);

echo 'str_replace：'.$_letter0 ."<br/>";
echo 'strlen:'. strlen($_letter0) ."<br/>";
echo 'substred1：'.$_letter1 ."<br/>";
echo 'substred2：'.$_letter2 ."<br/>";
echo 'substred3：'.$_letter3 ."<br/>";


$_result= null;
$_strlen= strlen($_letter0);
if($_strlen == 3)//1个汉字
{
	$model1 =  Fcode::model()->findByPk($_letter1);
	if($model1== null ) throw  new CHttpException(1311,'找不到汉字[' .$_letter1.']的四角编码，请联系管理员进行维护！');
	echo '分别：'.$_letter1 . $model1->fcode;
	$_result = $model1->fcode;
}
else if($_strlen == 6)//2个汉字
{
	$model1 =  Fcode::model()->findByPk($_letter1);
	$model2 =  Fcode::model()->findByPk($_letter2);
	if($model1 ==null)
		throw  new CHttpException(404,'找不到汉字[' .$_letter1 .']的四角编码，请联系管理员进行维护！');
	if($model2== null)
		throw  new CHttpException(404,'找不到汉字[' .$_letter2 .']的四角编码，请联系管理员进行维护！');
	echo '分别：'.$_letter1 . $model1->fcode .$_letter2 . $model2->fcode;
	$_result =substr( $model1->fcode, 0,2) . substr( $model2->fcode, 0,2);
}
else{
	//3个以上
	$model1 =  Fcode::model()->findByPk($_letter1);
	$model2 =  Fcode::model()->findByPk($_letter2);
	$model3 =  Fcode::model()->findByPk($_letter3);
	
	
	if($model1 ==null)
		throw  new CHttpException(404,'找不到汉字[' .$_letter1 .']的四角编码，请联系管理员进行维护！');
	if($model2== null)
		throw  new CHttpException(404,'找不到汉字[' .$_letter2 .']的四角编码，请联系管理员进行维护！');
	if($model3 ==null)
		throw  new CHttpException(404,'找不到汉字[' .$_letter3 .']的四角编码，请联系管理员进行维护！');
	
	echo '分别：'.$_letter1 . $model1->fcode .$_letter2 . $model2->fcode .$_letter3 . $model3->fcode .'<br/>';
	
	$_result =substr( $model1->fcode, 0,2) . substr( $model2->fcode, 0,1). substr( $model3->fcode, 0,1);
}


if($model1 != null) 
	echo '四角编码：'.$_result ; */
?>
<?php 
echo CHtml::label('测试下',false,array('id'=>'newtest'));

$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
    'id'=>'mydialog',
    // additional javascript options for the dialog plugin
    'options'=>array(
        'title'=>'测试窗口',
        'autoOpen'=>false,
    ),
));

    echo 'dialog content here';
    
    echo $this->renderPartial('_form1') ;
$this->endWidget('zii.widgets.jui.CJuiDialog');

// the link that may open the dialog
echo CHtml::link('open dialog', '#', array(
   'onclick'=>'$("#mydialog").dialog("open"); return false;',
));
?>

